
function max(arr:number[]):number{
    let num:number=0
    let count:number=0
    let sun:number=0
    arr.forEach((item,index)=>{
        if((index+1)%2==0){
            count =item
        }else if((index+1)%2!=0&&index!=0){
            sun=item-count
            num+=sun
        }
    })
    return num
}
console.log(max([7,1,5,3,6,4]));
console.log(max([7,4,5,3,6,4]));


function use(a:number,b:number):number{
    return a+b
}

console.log(use(6,6));


function bl(arr:number[]):number{
    let arr1:number=0
    arr.forEach((item:number,index:number)=>{
        arr1+=item
    })

    return arr1
}

console.log(bl(([1,5,6,9,7])));






